package com.jsoft.dao.impl;

import com.jsoft.dao.EnterpriseDao;
import com.jsoft.entity.Enterprise;
import com.jsoft.util.DAO;

import java.util.List;

/**
 * @author:sha
 * @email:o68o4741@163.com
 * @date:2023/2/20
 */
public class EnterpriseDaoImpl extends DAO<Enterprise> implements EnterpriseDao {
    @Override
    public List<Enterprise> listEnterpriseNames(Integer id) throws Exception {
        String sql ="select `NAME` from enterprise where `id` NOT IN(?)";
        return getForList(sql,id);
    }

    @Override
    public String getEnterpriseName(Integer id) throws Exception {
        String sql ="select DISTINCT enterprise.`name` from enterprise where id=?";
        return getForValue(sql,id);
    }

    @Override
    public String getSocialUniformCode(String name) throws Exception {
        String sql = "select social_uniform_code from enterprise where `name`=?";
        return getForValue(sql, name);
    }

    @Override
    public Integer getEnterpriseId(String name) throws Exception {
        String sql = "select id from enterprise where `name`=?";
        return getForValue(sql, name);
    }
}
